<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="application/rdf+xml; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>  

<%@page import="net.groupme.api.ontology.GroupMeOntology"%>
<%@page import="net.groupme.api.ontology.FOAFOntology"%>
<%@page import="net.groupme.api.ontology.TagOntology"%>
<rdf:RDF
    xmlns="<%= GroupMeOntology.NS %>"
    xmlns:foaf="<%= FOAFOntology.NS %>"
    xmlns:dct="http://purl.org/dc/terms/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
    xmlns:owl="http://www.w3.org/2002/07/owl#"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:tags="<%= TagOntology.NS %>"
  xml:base="<%= GroupMeOntology.BASE %>">

  <foaf:<%= FOAFOntology.DOCUMENT %> rdf:about="<c:out value="${resource.URI}"/>">
  	  <!-- Name, description, and alternative ULR of the resource -->
      <dc:title><c:out value="${resource.name}" /></dc:title>
      <dc:description><c:out value="${resource.description}" ></c:out></dc:description>
      <rdfs:seeAlso rdf:resource="<c:out value="${resource.URL}"/>"/>
      <!-- Groups the resource is contained in -->
      <c:forEach items="${resource.groups}" var="group" varStatus="status">
			<<%= GroupMeOntology.CONTAINED_IN %>>
			    <<%= GroupMeOntology.GROUP %> rdf:about="<c:out value='${group.URI}'/>">
			    	<dc:title><c:out value='${group.name}'/></dc:title>
			    	<dc:description><c:out value='${group.description}'/></dc:description>
			    </<%= GroupMeOntology.GROUP %>>
			 </<%= GroupMeOntology.CONTAINED_IN %>>
			 
			 <!-- Related resources (= resources the resource is grouped with in that group) -->
			 <c:forEach items="${group.resources}" var="relatedRes" varStatus="statusB">
			 	<c:if test="${resource.URI != relatedRes.URI}"><dc:relation rdf:resource="<c:out value="${relatedRes.URI}"/>"/></c:if>
			 </c:forEach>
	  </c:forEach>
	  <!--  tags assigned to the resource -->
	  <c:forEach items="${resource.tags}" var="tag" varStatus="status">
	  	<tags:<%= TagOntology.TAGGED_WITH_TAG %>>
	  		<tags:<%= TagOntology.TAG %> rdf:about="<c:out value='${tag.URI}'/>">
	  			<tags:<%= TagOntology.NAME %>><c:out value='${tag.keyword}'/></tags:<%= TagOntology.NAME %>>
	  		</tags:<%= TagOntology.TAG %>>
	  	</tags:<%= TagOntology.TAGGED_WITH_TAG %>>
	  </c:forEach>
  </foaf:<%= FOAFOntology.DOCUMENT %>>
</rdf:RDF>